fix: 헤딩 앵커 링크 변환 시 HTML 포맷팅 보존하도록 수정#283
Merged
pronist merged 3 commits intopronist:masterfrom Nov 7, 2025
Merged
Conversation
- setAnchorToHeading에서 textContent 대신 innerHTML 사용 - <b>, <strong> 태그 등 원본 HTML 구조 유지 - 앵커 변환 과정에서 헤딩 서식이 사라지는 문제 해결
pronist
reviewed
Nov 7, 2025
Owner
pronist
left a comment
There was a problem hiding this comment.
@archan0621 안녕하세요. 일이 있었어서 이 코드에 대한 피드백을 늦게 드리는군요.
테스트해본 결과, 정상적으로 동작은 하기 때문에 바로 반영해도 상관은 없지만, 코드가 깔끔하지 않습니다. 해당 PR을 반영하고 제가 다시 고쳐도 되지만, 기왕 PR을 주셨기 때문에 코드 리뷰를 해드리고 더 나은 코드로 반영해보는 것이 어떨까 싶어서요.
원 소스코드에는 $anchor() 가 사용되어 있으나 현 코드에서는 사용되지 않고 기능 위주의 구현만 되어 있는 상태입니다. 이러면 $anchor() 함수는 무용지물이라 볼 수 있겠죠. 따라서 $anchor()를 사용하는 형태로 바꿔보세요. 이미 textContent 가 문제라는 것을 파악하신 상태이기 때문에 setAnchorToHeading()은 변경할 필요가 없다는 것을 인지하셨을 것입니다.
Contributor
Author
|
앗 그러네요! 기존 코드에 대한 파악이 부족하였습니다.. 수정해서 반영하였습니다! |
Owner
|
@archan0621 좋습니다. 이제 반영하도록 하겠습니다. PR 주셔서 고맙습니다 :)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #282
문제점
헤딩에 굵게, 기울임 등의 서식이 적용된 경우, 앵커 링크로 변환되는 과정에서 HTML 서식이 제거되어 시각적 스타일이 사라지는 문제가 있었습니다.
수정 전:
수정 후:
해결방법
Content.pug의setAnchorToHeading메서드에서textContent대신innerHTML을 사용하도록 변경:textContent는 모든 HTML 태그를 제거innerHTML은 원본 HTML 구조를 보존변경사항
assets/pug/Mixins/Permalink/Content.pug수정textContent에서innerHTML로 변경innerHTML설정테스트 결과
스크린샷